home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / lib / partman / active_partition / 65toggle_bootable / do_option < prev   
Encoding:
Text File  |  2009-04-19  |  1.1 KB  |  66 lines

  1. #!/bin/sh
  2.  
  3. . /lib/partman/lib/base.sh
  4.  
  5. task=$1
  6. dev=$2
  7. id=$3
  8.  
  9. cd $dev
  10.  
  11. if [ "$task" = bootable ]; then
  12.     open_dialog PARTITION_INFO $id
  13.     read_line x1 x2 x3 type x5 x6 x7
  14.     close_dialog
  15.     if [ "$type" = logical ]; then
  16.         db_input high partman-partitioning/bootable_logical || true
  17.         db_go || exit 0
  18.         db_get partman-partitioning/bootable_logical
  19.         [ "$RET" = true ] || exit 0
  20.     fi
  21. fi
  22.  
  23. new_flags=''
  24. open_dialog GET_FLAGS $id
  25. while { read_line flag; [ "$flag" ]; }; do
  26.     if [ "$flag" != boot ]; then
  27.         if [ "$new_flags" ]; then
  28.             new_flags="$new_flags
  29. $flag"
  30.         else
  31.             new_flags="$flag"
  32.         fi
  33.     fi
  34. done
  35. close_dialog
  36.  
  37. if [ $task = bootable ]; then
  38.     new_flags="$new_flags
  39. boot"
  40. fi
  41.  
  42. open_dialog SET_FLAGS $id
  43. write_line "$new_flags"
  44. write_line NO_MORE
  45. close_dialog
  46.  
  47. partitions=''
  48. numparts=1
  49. open_dialog PARTITIONS
  50. while { read_line num id size type fs path name; [ "$id" ]; }; do
  51.     [ "$fs" != free ] || continue
  52.     partitions="$partitions $id"
  53.     numparts=$(($numparts + 1))
  54. done
  55. close_dialog
  56.  
  57. db_progress START 0 $numparts partman/text/please_wait
  58. db_progress INFO partman-partitioning/new_state
  59.  
  60. for id in $partitions; do
  61.     update_partition $dev $id
  62.     db_progress STEP 1
  63. done
  64.  
  65. db_progress STOP
  66.